﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using ASPNETVN.PORTAL.Components.Helpers;
using ASPNETVN.PORTAL.Components.Security;
using ASPNETVN.PORTAL.Components.UI;
using ASPNETVN.PORTAL.Components.Share.Controls;
using ASPNETVN.PORTAL.Components.Share;
using ASPNETVN.PORTAL.Modules.SCHEDULE.Components;

namespace ASPNETVN.PORTAL.Modules.SCHEDULE.Controls
{
    public partial class Detail : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Components.Item item = Components.Item.Load(this.ItemID);
                if (item != null)
                {
                    int departmentID = item.DepartmentID;
                    Department department = Department.Load(departmentID);
                    if (department != null)
                    {
                        lblCap.Text = department.Title;
                    }

                    lblTieuDe.Text = item.Title;
                    this.lblTuNgay.Text = item.FromDate.ToString().Substring(0, item.FromDate.ToString().IndexOf(" "));
                    this.lblDenNgay.Text = item.ToDate.ToString().Substring(0, item.ToDate.ToString().IndexOf(" "));
                    this.lblNguoiTao.Text = item.CreatedBy;
                    this.lblNgayTao.Text = item.CreatedDate.ToString().Substring(0, item.CreatedDate.ToString().IndexOf(" "));
                    this.lblChiTiet.Text = Server.HtmlDecode(item.Description);                    
                }
            }
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            string url = HttpUrlBuilder.BuildModulePageUrl(this.ModuleID, 0, ModulePages.Item);
            Response.Redirect(url);
        }
    }
}